package com.pgeg.listener;

import com.pgeg.registry.ItemGroupRegistry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.entity.EntityType;
import net.minecraft.item.BoneMealItem;
import net.minecraft.item.Item;
import net.minecraft.item.SpawnEggItem;

public class ItemListener {

    /*Magic Items*/
    public static final Item MANA_CRYSTAL_DUST = new Item(genSettings());
    public static final Item WAND = new Item(genRareSettings());
    public static final Item COMPENDIUM = new Item(genSettings());
    public static final Item RUNE_FIRE = new Item(genSettings());
    public static final Item AIR_SHARD = new Item(genSettings());
    public static final Item FIRE_SHARD = new Item(genSettings());
    public static final Item EARTH_SHARD = new Item(genSettings());
    public static final Item WATER_SHARD = new Item(genSettings());
    public static final Item ORDER_SHARD = new Item(genSettings());
    public static final Item ENTROPY_SHARD = new Item(genSettings());

    /*Other Items*/
    public static final Item PLANT_TREAT = new BoneMealItem(genSettings());
    public static final Item PIG_LEATHER = new Item(genMealItemSettings());

    /*Ingots*/
    public static final Item ORICHALCUM_INGOT =  new Item(genSettings());
    public static final Item SATURNIUM_INGOT =  new Item(genSettings());
    public static final Item BRIMSTONE_INGOT =  new Item(genSettings());
    public static final Item METEORITE_INGOT =  new Item(genSettings());
    public static final Item MITHRIL_INGOT =  new Item(genSettings());
    public static final Item COPPER_INGOT =  new Item(genSettings());
    public static final Item SILVER_INGOT = new Item(genSettings());
    public static final Item REDSTONE_CUT_INGOT = new Item(genSettings());
    public static final Item REDSTONE_INGOT = new Item(genSettings());

    /*Spawn Eggs*/
    public static final Item FUTA_COW_SPAWN_EGG = genSpawnEggSettings(EntityListener.FUTA_COW);

    private static FabricItemSettings genSettings() {
        return new FabricItemSettings().group(ItemGroupRegistry.COMMON_GROUP);
    }

    private static SpawnEggItem genSpawnEggSettings(EntityType type) {
        return new SpawnEggItem(type, 12895428, 11382189, new Item.Settings().group(ItemGroupRegistry.COMMON_GROUP));
    }
    private static FabricItemSettings genMealItemSettings() {
        return new FabricItemSettings().group(ItemGroupRegistry.COMMON_GROUP);
    }

    private static FabricItemSettings genRareSettings() {
        return new FabricItemSettings().group(ItemGroupRegistry.COMMON_GROUP).maxCount(1);
    }
}
